package logic

import (
	"context"
	"doc-manage/models/mysql"

	"doc-manage/docrpc/docrpc"
	"doc-manage/docrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DocListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDocListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocListLogic {
	return &DocListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 医生列表
func (l *DocListLogic) DocList(in *docrpc.DocListRequest) (*docrpc.DocListResponse, error) {
	// todo: add your logic here and delete this line

	//var list []*docrpc.DoctorList
	//var err error

	list, err := mysql.DoctorList(mysql.DB)
	if err != nil {
		return nil, err
	}

	return &docrpc.DocListResponse{
		List: list,
	}, nil
}
